<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class User extends MY_Controller {

	function __construct()
	{
		parent::__construct();
		$this->load->library('form_validation');
		$this->form_validation->set_error_delimiters('<span class="error"></span>');
	}
	
	function register()
	{
		if($this->user_lib->is_logged_in())
			redirect('');
		$this->_add_js('register');
		$this->data->head->title = "회원가입";
		$this->data->education = $this->config->item('education');
		$this->data->address = $this->misc_model->create_address_array();
		$this->load->view('user/register', $this->data);
	}
	
	function login()
	{
		$redirect = $this->input->get_post('redirect_to');
		if($redirect)
		{
			if(substr($redirect, 0, 4) != 'http')
				$redirect = site_url($redirect);
				
			$this->data->redirect_to = $redirect;
		}
		if($this->user_lib->is_logged_in())
			redirect('');
		$this->load->view('user/login', $this->data);
	}
	
	function logout()
	{
		if( ! $this->user_lib->is_logged_in())
			redirect('');
		$this->user_lib->logout();
		$this->load->view('user/logout', $this->data);
	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/user.php */